home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / a_utils / _archvrs / unix / tcx-1_0.lha / tcx-1.0 / config.h next >
C/C++ Source or Header  |  1993-03-30  |  7KB  |  174 lines

  1. /* config.h, Version 1.0, 25/3/1993 by Stewart Forster */
  2.  
  3. /************************************************************************/
  4. /*   Copyright (C) 1993 Stewart Forster                    */
  5. /*  This program is free software; you can redistribute it and/or modify*/
  6. /*  it under the terms of the GNU General Public License as published by*/
  7. /*  the Free Software Foundation; either version 2, or (at your option) */
  8. /*  any later version.                            */
  9. /*                                    */
  10. /*  This program is distributed in the hope that it will be useful,    */
  11. /*  but WITHOUT ANY WARRANTY; without even the implied warranty of    */
  12. /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    */
  13. /*  GNU General Public License for more details.            */
  14. /*                                    */
  15. /*  You should have received a copy of the GNU General Public License    */
  16. /*  along with this program; if not, write to the Free Software        */
  17. /*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.        */
  18. /************************************************************************/
  19.  
  20.  
  21. /************************************************************************/
  22. /*    OS TYPE DEFINITION                        */
  23. /* Define one of the following where appropriate            */
  24. /************************************************************************/
  25.  
  26. /* #define    SUNOS        /* */
  27. #define    IRIX        /* */
  28. /* #define    ULTRIX        /* */
  29.  
  30. /************************************************************************/
  31. /* SUNOS requires the pstat command to be available.  This is part of     */
  32. /* the SunOs distribution but fix this following path if it's wrong.    */
  33. /************************************************************************/
  34.  
  35. #ifdef SUNOS
  36. #define    PSTATI    "/usr/etc/pstat -i"
  37. #endif
  38.  
  39. /************************************************************************/
  40. /* PATHUNTCX is the pathname where the untcx executable resides.  Note    */
  41. /* that this is the interpreter/unpacker and hence must exist with this    */
  42. /* path, or else the whole system will fail! This path should also be on*/
  43. /* a filesystem which the local system trusts setuid binaries from,    */
  44. /* since PATHUNTCX must run setuid to root.                */
  45. /************************************************************************/
  46.  
  47. #define    PATHUNTCX    "/usr/local/bin/untcx"
  48.  
  49. /************************************************************************/
  50. /* PATHTCX is the pathname to the tcx executable.  This does not have to*/
  51. /*  be installed setuid.                        */
  52. /************************************************************************/
  53.  
  54. #define    PATHTCX        "/usr/local/bin/tcx"
  55.  
  56. /************************************************************************/
  57. /* PATHPACKER is the pathname to the compression program you wish to use*/
  58. /* with the system. PACKEROPTS is an optional definition of options you    */
  59. /* wish to pass to the packer program. NB. The compression program must    */
  60. /* be a `filter', that is, it is capable of reading from stdion and    */
  61. /* compressing to stdout.                        */
  62. /************************************************************************/
  63.  
  64. #define    PATHPACKER    "/usr/local/bin/gzip"
  65. /*#define    PACKEROPTS    "-7"            /* Optional */
  66.  
  67. /************************************************************************/
  68. /* PATHUNPACK and the optional UNPACKOPTS serve a similar purpose to    */
  69. /* PATHPACKER and PACKEROPTS above. */
  70. /************************************************************************/
  71.  
  72. #define    PATHUNPACK    "/usr/local/bin/gzip"
  73. #define    UNPACKOPTS    "-d"            /* Optional */
  74.  
  75. /************************************************************************/
  76. /* ENFSDIR is the pathname to the directory where emergency (out of disk*/
  77. /* space locally) or NFS mounted executables get unpacked to.        */
  78. /************************************************************************/
  79.  
  80. #define    ENFSDIR        "/tmp/exec"
  81.  
  82. /************************************************************************/
  83. /* SCANRATE is the interval in seconds which the tcx daemon waits before*/
  84. /* rescanning all files it is currently managing, for recompression in    */
  85. /* the case of local files, or deletion from ENFSDIR in the case of     */
  86. /* emergency or NFS mounted executables.  Note that SCANRATE should    */
  87. /* probably not be larger than ENFSTIMEOUT or LOCALTIMEOUT defined    */
  88. /* below, otherwise you will undermine the purpose of those variables.    */
  89. /************************************************************************/
  90.  
  91. #define    SCANRATE    60        /* 60 seconds between scans */
  92.  
  93. /************************************************************************/
  94. /* ENFSTIMEOUT is the least number of seconds of disuse of an executable*/
  95. /* residing in ENFSDIR the tcx daemon will wait for, before it attempts    */
  96. /* to delete the executable. This should be set quite low if there isn't*/
  97. /* much disk space available in ENFSDIR.                */
  98. /* On SUNOS, this value only sets in after the inode is timed out of the*/
  99. /* inode cache.  This problem will be addressed in a future release.    */
  100. /************************************************************************/
  101.  
  102. #define    ENFSTIMEOUT    60        /* 60 seconds of inactivity */
  103.  
  104. /************************************************************************/
  105. /* LOCALTIMEOUT is the least number of seconds of disuse of an        */
  106. /* executable residing locally on the system that the tcx will wait    */
  107. /* before attempting to repack the executable.                */
  108. /* On SUNOS, this value only sets in after the inode is timed out of the*/
  109. /* inode cache.  This problem will be addressed in a future release.    */
  110. /************************************************************************/
  111.  
  112. #define    LOCALTIMEOUT    1800        /* 30 minutes */
  113.  
  114.  
  115.  
  116.  
  117. /************************************************************************/
  118. /************************************************************************/
  119. /* You should not need to edit anything after this point        */
  120. /************************************************************************/
  121. /************************************************************************/
  122.  
  123. #define    MAXHEADERSIZE    256
  124.  
  125. /* Define PUSLEEP (portable usleep definition)    */
  126.  
  127. #ifdef    IRIX
  128. #define _BSD_SIGNALS
  129. #define    PUSLEEP(x)    (sginap((long)((x)/10000)))
  130. #endif
  131.  
  132. #ifdef    ULTRIX
  133. #define    PUSLEEP(x)    (usleep(x))    /* usleep code in untcx.c */
  134. #endif
  135.  
  136. #ifdef    SUNOS
  137. #define    PUSLEEP(x)    (usleep(x))
  138. #endif
  139.  
  140. #include    <stdlib.h>
  141. #include        <unistd.h>
  142. #include        <sys/time.h>
  143. #include        <sys/wait.h>
  144. #include        <sys/types.h>
  145.  
  146. #ifdef ULTRIX
  147. #include    <sys/param.h>
  148. #include    <sys/mount.h>
  149. #endif
  150.  
  151. #ifdef IRIX
  152. #include        <sys/statfs.h>
  153. #endif
  154.  
  155. #ifdef SUNOS
  156. #include        <sys/vfs.h>
  157. #endif
  158.  
  159. #include        <sys/stat.h>
  160.  
  161. #include    <fcntl.h>
  162. #include        <string.h>
  163. #include        <errno.h>
  164. #include        <signal.h>
  165. #include        <stdio.h>
  166.  
  167. #if defined(SUNOS) || defined(ULTRIX)
  168. #include    <utime.h>
  169. #endif
  170.  
  171. #ifndef    MAXPATHLEN
  172. #define    MAXPATHLEN    1024
  173. #endif
  174.